// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial

// Test that structs work if they are only referrenced by callbacks

struct Foo1 := { member: int, }
struct Foo2 := { a: Foo1 }
struct Foo3 := { b: int }


struct DeleteMe := { c: color }

TestCase := Rectangle {
    callback cb1(Foo2) -> Foo3;
    cb1(foo) => { return { b: foo.a.member+1 }; }

    property<Foo2> xx;
    pure callback cb2(Foo2, Foo2)->Foo2;
    property<Foo2> xx2: cb2(xx, xx);


    // Based on Issue #1733
    Rectangle {
        property<[DeleteMe]> data;
        for d[i] in data: Rectangle { }
    }
}


/*
```rust
let instance = TestCase::new().unwrap();

assert_eq!(instance.invoke_cb1(Foo2{ a: Foo1{ member: 123 } }).b, 124);
```

```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;

assert_eq(instance.invoke_cb1(Foo2{ Foo1{ 123 } }).b, 124);
```

```js
var instance = new slint.TestCase();
assert.equal(instance.cb1({a: {member: 123}}).b, 124);
```

*/
